home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / undoc2eh.zip / UNDOC2EH.ASM next >
Assembly Source File  |  1993-05-04  |  3KB  |  109 lines

  1. comment    |
  2.  
  3.     This program, UNDOC2EH, was written by Hardin Brothers and it appeared
  4.     in the May 1988 issue of _PC Resource_.
  5.  
  6.     This copy was obtained from the "Clone Phone BBS", which is PCResource's
  7.     owned and operated service to its readers: (603)924-9337 2400/1200/300 8N1
  8.  
  9.     The entire contents of the May 1988 issue of _PC Resource_ is
  10.         Copyright (c) 1988 by IDG Communications/Peterborough, Inc.
  11.  
  12. --> This program waits for any key to be typed after a message is placed on
  13. --> the console before continuing!
  14.  
  15.     This program is offered as a solution (albeit undocumented!) to the
  16.     problem of how does a child of the resident/permanent COMMAND.COM add
  17.     a shell variable to the parent/root environment without modifying
  18.     AUTOEXEC.BAT and rebooting?
  19.  
  20.     Hardin Brothers points out that this is a relatively "dangerous" technique
  21.     since it goes 'against the grain' of the usual parent-child relationship.
  22.     On the other hand, he says that for adding a new variable to the root
  23.     environment or for changing the system prompt without requiring a reboot,
  24.     this technique seems ideal. He recommends that this technique never be
  25.     used to spawn a child process -- use the program he wrote that uses the
  26.     documented technique instead (see PCRSPWN1.ARC).
  27.  
  28.     Hardin Brothers reports that neither DOS itself nor COMMAND.COM use this
  29.     interrupt service. He says the "accepted" method [how can a method be
  30.     "accepted" if the service is undocumented?] is for the parent to use the
  31.     same technique as when spawning a child process using the documented
  32.     INT 21h Service 4Bh. Set DS:SI to point to a DOS command line string
  33.     before invoking INT 2Eh.
  34.  
  35.     Hardin Brothers uses the trigraph '==>' which when read is 'points to'.
  36.  
  37.     This program is the same as the original version in the magazine article
  38.     except for two changes:
  39.  
  40.         1- This opening comment and attribution block by me,
  41.             Chris Sylvain (cgs@umd5.umd.edu).
  42.         2- The name of the program was changed from RESET to UNDOC2EH.
  43.     |
  44.  
  45. comment |
  46.    This program demonstrates the UNDOCUMENTED DOS Interrupt, INT 2Eh.
  47.    It will reset the system prompt and then exit
  48.     |
  49.  
  50.     .MODEL SMALL
  51.     .STACK
  52.  
  53.     .DATA
  54.  
  55. cmd    db    lcmd_lin-1
  56. cmd_lin    db    'PROMPT This prompt set by UNDOC2EH$_$p $b$q$b ',0dh
  57. lcmd_lin equ    $-cmd_lin
  58.  
  59. msg1    db    'Calling DOS Execute interrupt',10,13,'$'
  60. msg2    db    'Return from Execute interrupt',10,13,'$'
  61.  
  62.     .CODE
  63. old_sp    dw    ?
  64. old_ss    dw    ?
  65.  
  66. start:    mov    ax,@data
  67.     mov    ds,ax            ;Initialize data segment
  68.     lea    dx,msg1            ;Print opening message
  69.     mov    ah,09h            ;Print a message
  70.     int    21h            ;DOS Request
  71.     call    pause            ;Let user see it
  72.     mov    bx,seg end_seg        ;Get end of our program
  73.     mov    ax,es            ;ES is seg of PSP
  74.     sub    bx,ax            ;BX = memory to keep
  75.     mov    ah,4ah            ;Set memory block
  76.     int    21h            ;DOS Request
  77.     jc    exit            ;Go if error
  78.  
  79.     push    ds            ;Save DS
  80.     mov    cs:old_sp,sp        ;Save our stack
  81.     mov    cs:old_ss,ss
  82.  
  83.     lea    si,cmd            ;DS:SI ==> command
  84.     int    2eh            ;Execute command
  85.  
  86.     cli                ;Turn off interrupts
  87.     mov    sp,cs:old_sp        ;Restore stack
  88.     mov    ss,cs:old_ss
  89.     sti                ;Interrupts back on
  90.  
  91.     pop    ds            ;Restore saved registers
  92.     lea    dx,msg2            ;Report success
  93.     mov    ah,09h            ;DOS Request
  94.     int    21h
  95.  
  96. exit:    mov    ax,4c00h        ;Return to DOS, no error
  97.     int    21h            ;DOS Request
  98.  
  99. pause    proc    near
  100.     mov    ah,07h            ;Keyboard input -- unfiltered
  101.     int    21h            ;DOS request
  102.     ret
  103. pause    endp
  104.  
  105. end_seg    segment
  106. end_seg    ends
  107.     end    start
  108.  
  109.